
**************ANTES DE NADA: RECORDAR QUE TEÑO QUE REVISAR QUE BASE DE DATOS USO E SE SACO OS DATOS QUE NON ESTÁN MERGED OU NON.


** 21.05.2024

***** Recoding of variables from LISS

********************************************************************************

set more off
set scheme plotplain


use "Pooled LISS data 1-15_replication file", clear


xtset nomem_encr wave

********************************************************************************

** Recoding

** Dependent variable: media consumption

ta po009

recode po009 (1 2=0 "Rarely") (3 4=1 "Often+Always") (else=.), into(media)

** Independent variables

**** Gender

* Gender respondent
/* Exploration of the variable*/
g gender=fa003
lab var gender "Gender respondent"
lab def gender 1"male" 2"female", replace
lab val gender gender
/* Imputation of responses*/
gsort nomem_encr wave
quietly by nomem_encr: replace gender = gender[_n-1] if gender >= . 
replace gender=fa536 if gender>=.
/* Recode into a dummy*/
recode gender (1=0) (2=1)
lab def gender 0"men" 1"women", replace
lab val gender gender
recode gender (3=.)




** WORK TO BE DONE

**** Employment status --> items w088-w102 cover a wide variety of situations.
/* We need to give a thought to the kind of situations that we are going to include.
Response categories are yes or no.
Respondents can reply yes to several options. When respondents chose several options
they are posed question w104, where they are asked to choose the option that best 
describes their situation.*/

** w121 --> length of contract (permanent/temporary/on call/self-employed/owner)

** Creating a variable out of the values in w088-w102+w104

ta w088

g work=.
/* Currently paid work */ replace work=1 if w088==1 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 &w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Not working but worked before */ replace work=2 if w088==0 & w089==1 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Unpaid work + getting benefits */replace work=3 if w088==0 & w089==0 & w090==1 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Looking for a job */ replace work=4 if w088==0 & w089==0 & w090==0 & w091==1 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Not obliged to work but worked before */ replace work=5 if w088==1 & w089==0 & w090==0 & w091==0 & w092==1 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* First-time job-seeker*/ replace work=6 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==1 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Seeking job after a lengthy interruption*/ replace work=7 if w088==7 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==1 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Student */replace work=8 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==1 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Housewife/man */ replace work=9 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==1 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Live off private means*/ replace work=10 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==1 & w098==0 & w099==0 & w100==0 & w101==0 & w102==0
/* Early retirement */ replace work=11 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==1 & w099==0 & w100==0 & w101==0 & w102==0
/* Pensioner */ replace work=12 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==1 & w100==0 & w101==0 & w102==0
/* Disabled for work */ replace work=13 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==1 & w101==0 & w102==0
/* Voluntary work only */ replace work=14 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==1 & w102==0
/* Paid work but looking for sth better */ replace work=15 if w088==0 & w089==0 & w090==0 & w091==0 & w092==0 & w093==0 & w094==0 & w095==0 & w096==0 & w097==0 & w098==0 & w099==0 & w100==0 & w101==0 & w102==1
/* For those who ticked several options, question w104 asks them to choose which is the one that best defines their current situation.*/
replace work=1 if w104==1
replace work=2 if w104==2
replace work=3 if w104==3
replace work=4 if w104==4
replace work=5 if w104==5
replace work=6 if w104==6
replace work=7 if w104==7
replace work=8 if w104==8
replace work=9 if w104==9
replace work=10 if w104==10
replace work=11 if w104==11
replace work=12 if w104==12
replace work=13 if w104==13
replace work=14 if w104==14
replace work=15 if w104==15

lab define work 1"Paid work" 2"Not working now" 3"Unpaid work + benefits" 4 "Job-seeker" 5"Not obliged to work but worked before" 6"First-time job-seeker" 7"Job-seeker after long interruption" 8"Student" 9"Housewife/man" 10"Private means" 11"Early retirement" 12"Pensioner" 13"Disabled" 14"Voluntary work only" 15"Working+job-seeker"

lab values work work

recode work (1 15=1 "Working") (2 3 5 10 14 = 2 "Not working") (4 6 7=3 "Job-seeking") (8=4 "Student") (9=5 "Housewife/man") (11 12 13=6 "Pensioner/disabled") (else=.), into(workstatus)
label variable workstatus "Working status"

recode work (1 15=1 "Active") (2 3 5 10 14 4 6 7 8 9 11 12 13=0 "Inactive") (else=.), into(active)
label variable active "Working status"

/* recode work (1 15=1 "Fulltime") */

** w127 --> amount of hours worked weekly on average in your last job. Check at proposal of coding
tab w127
gen wrkhourday=w127/5
tab wrkhourday
recode wrkhourday (0.1/0.8=0) (1/5.9=1) (6/14=2), gen(wrkday)
label define wrkday 0 "no work" 1 "part-time" 2 "full-time"
label value wrkday wrkday
tab wrkday
replace wrkday=0 if active==0
***There is a problem with this measure, because people who are on parental leave are asked to tell how much less they are working. And people who said they are currently working does not tell how many hours they work (holidays?)



**ALTERNATIVE CODING FOR part-time jobs
*number of hours in contract w126, combined with number of hours effectively worked w127
recode w126 (1/24=1) (25/200=2), gen(typejob)
replace typejob=1 if w127<25
replace typejob=2 if w127>24
replace typejob=0 if active==0
label define typejob 0 "no work" 1 "part-time" 2 "full-time"
label value typejob typejob
***same problem as above


**** Having children
/* Have you had children --> fa035 [2008-2014] -> fa454 [20015-2022] */
ta fa035
ta fa454
/* Generate variable */
g children=.
replace children=fa035 if wave<=2014
replace children=fa454 if wave>=2015
/* explore whether the replace worked */ ta children wave
/* imputation of responses */ gsort nomem_encr wave
quietly by nomem_encr: replace children = children[_n-1] if children >= . 
/* recode into a dummy */ recode children (1=1) (2=0)
lab def children 0"no" 1"yes", replace
lab val children children
lab var children "Have you had any children?"
*alternative measure to check
gen childrenalt=0
replace childrenalt=1 if fa037!=.
replace childrenalt=1 if fa456!=.


** Do you want (more) children?

ta fa128

**alternative recoding to check whether there are differences between mothers and "wanting mothers"
gen selfselection=.
replace selfselection=0 if fa128==2 & children==0
replace selfselection=1 if fa128==2 & children==1
replace selfselection=1 if fa128==1 & children==1
replace selfselection=2 if fa128==1 & children==0
label define selfselection 0 "no kids wanted" 1 "already have" 2 "kids wanted"
label value selfselection selfselection
tab selfselection fa128, m


**using an alternative variable that asks when they want to have children
 tab fa130
 
 gen selfselectionyear=fa130
 replace selfselectionyear=5 if fa130==2025
 replace selfselectionyear=1 if fa130==2022
 recode selfselectionyear (1/5=1) (6/10=2) (11/50=3)
 label def selfselectionyear 0 "pregnant" 1 "5 years" 2 "10 years" 3 "more than 10 years"
 label val selfselectionyear selfselectionyear
 tab selfselectionyear
 


*****************************************************


****** Parents category



/* Variable that identifies the kids by age */
g kidagefirst=.
replace kidagefirst=2008-fa037 if wave==2008
replace kidagefirst=2009-fa037 if wave==2009
replace kidagefirst=2010-fa037 if wave==2010
replace kidagefirst=2011-fa037 if wave==2011
replace kidagefirst=2012-fa037 if wave==2012
replace kidagefirst=2013-fa037 if wave==2013
replace kidagefirst=2014-fa037 if wave==2014
replace kidagefirst=2015-fa456 if wave==2015
replace kidagefirst=2016-fa456 if wave==2016
replace kidagefirst=2017-fa456 if wave==2017
replace kidagefirst=2018-fa456 if wave==2018
replace kidagefirst=2019-fa456 if wave==2019
replace kidagefirst=2020-fa456 if wave==2020
replace kidagefirst=2021-fa456 if wave==2021
replace kidagefirst=2022-fa456 if wave==2022
lab variable kidagefirst "Age of first child"

g kidagesecond=.
replace kidagesecond=2008-fa038 if wave==2008
replace kidagesecond=2009-fa038 if wave==2009
replace kidagesecond=2010-fa038 if wave==2010
replace kidagesecond=2011-fa038 if wave==2011
replace kidagesecond=2012-fa038 if wave==2012
replace kidagesecond=2013-fa038 if wave==2013
replace kidagesecond=2014-fa038 if wave==2014
replace kidagesecond=2015-fa457 if wave==2015
replace kidagesecond=2016-fa457 if wave==2016
replace kidagesecond=2017-fa457 if wave==2017
replace kidagesecond=2018-fa457 if wave==2018
replace kidagesecond=2019-fa457 if wave==2019
replace kidagesecond=2020-fa457 if wave==2020
replace kidagesecond=2021-fa457 if wave==2021
replace kidagesecond=2022-fa457 if wave==2022
lab variable kidagesecond "Age of second child"

g kidagethird=.
replace kidagethird=2008-fa039 if wave==2008
replace kidagethird=2009-fa039 if wave==2009
replace kidagethird=2010-fa039 if wave==2010
replace kidagethird=2011-fa039 if wave==2011
replace kidagethird=2012-fa039 if wave==2012
replace kidagethird=2013-fa039 if wave==2013
replace kidagethird=2014-fa039 if wave==2014
replace kidagethird=2015-fa458 if wave==2015
replace kidagethird=2016-fa458 if wave==2016
replace kidagethird=2017-fa458 if wave==2017
replace kidagethird=2018-fa458 if wave==2018
replace kidagethird=2019-fa458 if wave==2019
replace kidagethird=2020-fa458 if wave==2020
replace kidagethird=2021-fa458 if wave==2021
replace kidagethird=2022-fa458 if wave==2022
lab variable kidagethird "Age of third child"

g kidagefourth=.
replace kidagefourth=2008-fa040 if wave==2008
replace kidagefourth=2009-fa040 if wave==2009
replace kidagefourth=2010-fa040 if wave==2010
replace kidagefourth=2011-fa040 if wave==2011
replace kidagefourth=2012-fa040 if wave==2012
replace kidagefourth=2013-fa040 if wave==2013
replace kidagefourth=2014-fa040 if wave==2014
replace kidagefourth=2015-fa459 if wave==2015
replace kidagefourth=2016-fa459 if wave==2016
replace kidagefourth=2017-fa459 if wave==2017
replace kidagefourth=2018-fa459 if wave==2018
replace kidagefourth=2019-fa459 if wave==2019
replace kidagefourth=2020-fa459 if wave==2019
replace kidagefourth=2021-fa459 if wave==2021
replace kidagefourth=2022-fa459 if wave==2022
lab variable kidagefourth "Age of fourth child"

g kidagefifth=.
replace kidagefifth=2008-fa041 if wave==2008
replace kidagefifth=2009-fa041 if wave==2009
replace kidagefifth=2010-fa041 if wave==2010
replace kidagefifth=2011-fa041 if wave==2011
replace kidagefifth=2012-fa041 if wave==2012
replace kidagefifth=2013-fa041 if wave==2013
replace kidagefifth=2014-fa041 if wave==2014
replace kidagefifth=2015-fa460 if wave==2015
replace kidagefifth=2016-fa460 if wave==2016
replace kidagefifth=2017-fa460 if wave==2017
replace kidagefifth=2018-fa460 if wave==2018
replace kidagefifth=2019-fa460 if wave==2019
replace kidagefifth=2020-fa460 if wave==2020
replace kidagefifth=2021-fa460 if wave==2021
replace kidagefifth=2022-fa460 if wave==2022
lab variable kidagefifth "Age of fifth child"

g kidagesixth=.
replace kidagesixth=2008-fa042 if wave==2008
replace kidagesixth=2009-fa042 if wave==2009
replace kidagesixth=2010-fa042 if wave==2010
replace kidagesixth=2011-fa042 if wave==2011
replace kidagesixth=2012-fa042 if wave==2012
replace kidagesixth=2013-fa042 if wave==2013
replace kidagesixth=2014-fa042 if wave==2014
replace kidagesixth=2015-fa461 if wave==2015
replace kidagesixth=2016-fa461 if wave==2016
replace kidagesixth=2017-fa461 if wave==2017
replace kidagesixth=2018-fa461 if wave==2018
replace kidagesixth=2019-fa461 if wave==2019
replace kidagesixth=2020-fa461 if wave==2020
replace kidagesixth=2021-fa461 if wave==2021
replace kidagesixth=2022-fa461 if wave==2022
lab variable kidagesixth "Age of sixth child"

g kidageseventh=.
replace kidageseventh=2008-fa043 if wave==2008
replace kidageseventh=2009-fa043 if wave==2009
replace kidageseventh=2010-fa043 if wave==2010
replace kidageseventh=2011-fa043 if wave==2011
replace kidageseventh=2012-fa043 if wave==2012
replace kidageseventh=2013-fa043 if wave==2013
replace kidageseventh=2014-fa043 if wave==2014
replace kidageseventh=2015-fa462 if wave==2015
replace kidageseventh=2016-fa462 if wave==2016
replace kidageseventh=2017-fa462 if wave==2017
replace kidageseventh=2018-fa462 if wave==2018
replace kidageseventh=2019-fa462 if wave==2019
replace kidageseventh=2020-fa462 if wave==2020
replace kidageseventh=2021-fa462 if wave==2021
replace kidageseventh=2022-fa462 if wave==2022
lab variable kidageseventh "Age of seventh child"

g kidageeigth=.
replace kidageeigth=2008-fa044 if wave==2008
replace kidageeigth=2009-fa044 if wave==2009
replace kidageeigth=2010-fa044 if wave==2010
replace kidageeigth=2011-fa044 if wave==2011
replace kidageeigth=2012-fa044 if wave==2012
replace kidageeigth=2013-fa044 if wave==2013
replace kidageeigth=2014-fa044 if wave==2014
replace kidageeigth=2015-fa463 if wave==2015
replace kidageeigth=2016-fa463 if wave==2016
replace kidageeigth=2017-fa463 if wave==2017
replace kidageeigth=2018-fa463 if wave==2018
replace kidageeigth=2019-fa463 if wave==2019
replace kidageeigth=2020-fa463 if wave==2020
replace kidageeigth=2021-fa463 if wave==2021
replace kidageeigth=2022-fa463 if wave==2022
lab variable kidageeigth "Age of eight child"

g kidageninth=.
replace kidageninth=2008-fa045 if wave==2008
replace kidageninth=2009-fa045 if wave==2009
replace kidageninth=2010-fa045 if wave==2010
replace kidageninth=2011-fa045 if wave==2011
replace kidageninth=2012-fa045 if wave==2012
replace kidageninth=2013-fa045 if wave==2013
replace kidageninth=2014-fa045 if wave==2014
replace kidageninth=2015-fa464 if wave==2015
replace kidageninth=2016-fa464 if wave==2016
replace kidageninth=2017-fa464 if wave==2017
replace kidageninth=2018-fa464 if wave==2018
replace kidageninth=2019-fa464 if wave==2019
replace kidageninth=2020-fa464 if wave==2020
replace kidageninth=2021-fa464 if wave==2021
replace kidageninth=2022-fa464 if wave==2022
lab variable kidageninth "Age of ninth child"

g kidagetenth=.
replace kidagetenth=2008-fa046 if wave==2008
replace kidagetenth=2009-fa046 if wave==2009
replace kidagetenth=2010-fa046 if wave==2010
replace kidagetenth=2011-fa046 if wave==2011
replace kidagetenth=2012-fa046 if wave==2012
replace kidagetenth=2013-fa046 if wave==2013
replace kidagetenth=2014-fa046 if wave==2014
replace kidagetenth=2015-fa465 if wave==2015
replace kidagetenth=2016-fa465 if wave==2016
replace kidagetenth=2017-fa465 if wave==2017
replace kidagetenth=2018-fa465 if wave==2018
replace kidagetenth=2019-fa465 if wave==2019
replace kidagetenth=2020-fa465 if wave==2020
replace kidagetenth=2021-fa465 if wave==2021
replace kidagetenth=2022-fa465 if wave==2022
lab variable kidagetenth "Age of tenth child"

g kidageeleventh=.
replace kidageeleventh=2008-fa047 if wave==2008
replace kidageeleventh=2009-fa047 if wave==2009
replace kidageeleventh=2010-fa047 if wave==2010
replace kidageeleventh=2011-fa047 if wave==2011
replace kidageeleventh=2012-fa047 if wave==2012
replace kidageeleventh=2013-fa047 if wave==2013
replace kidageeleventh=2014-fa047 if wave==2014
replace kidageeleventh=2015-fa466 if wave==2015
replace kidageeleventh=2016-fa466 if wave==2016
replace kidageeleventh=2017-fa466 if wave==2017
replace kidageeleventh=2018-fa466 if wave==2018
replace kidageeleventh=2019-fa466 if wave==2019
replace kidageeleventh=2020-fa466 if wave==2020
replace kidageeleventh=2021-fa466 if wave==2021
replace kidageeleventh=2022-fa466 if wave==2022
lab variable kidageeleventh "Age of eleventh child"

g  kidagetwelfth=.
replace  kidagetwelfth=2008-fa048 if wave==2008
replace  kidagetwelfth=2009-fa048 if wave==2009
replace  kidagetwelfth=2010-fa048 if wave==2010
replace  kidagetwelfth=2011-fa048 if wave==2011
replace  kidagetwelfth=2012-fa048 if wave==2012
replace  kidagetwelfth=2013-fa048 if wave==2013
replace  kidagetwelfth=2014-fa048 if wave==2014
replace  kidagetwelfth=2015-fa467 if wave==2015
replace  kidagetwelfth=2016-fa467 if wave==2016
replace  kidagetwelfth=2017-fa467 if wave==2017
replace  kidagetwelfth=2018-fa467 if wave==2018
replace  kidagetwelfth=2019-fa467 if wave==2019
replace  kidagetwelfth=2020-fa467 if wave==2020
replace  kidagetwelfth=2021-fa467 if wave==2021
replace  kidagetwelfth=2022-fa467 if wave==2022
lab variable  kidagetwelfth "Age of twelfth child"

g kidagethirteenth=.
replace kidagethirteenth=2008-fa049 if wave==2008
replace kidagethirteenth=2009-fa049 if wave==2009
replace kidagethirteenth=2010-fa049 if wave==2010
replace kidagethirteenth=2011-fa049 if wave==2011
replace kidagethirteenth=2012-fa049 if wave==2012
replace kidagethirteenth=2013-fa049 if wave==2013
replace kidagethirteenth=2014-fa049 if wave==2014
replace kidagethirteenth=2015-fa468 if wave==2015
replace kidagethirteenth=2016-fa468 if wave==2016
replace kidagethirteenth=2017-fa468 if wave==2017
replace kidagethirteenth=2018-fa468 if wave==2018
replace kidagethirteenth=2019-fa468 if wave==2019
replace kidagethirteenth=2020-fa468 if wave==2020
replace kidagethirteenth=2021-fa468 if wave==2021
replace kidagethirteenth=2022-fa468 if wave==2022
lab variable kidagethirteenth "Age of thirteenth child"


egen kidsmall=rowmin(kidagefirst kidagesecond kidagethird kidagefourth kidagefifth kidagesixth kidageseventh kidageeigth kidageninth kidagetenth kidageeleventh kidagetwelfth kidagethirteenth)



** same as above, but using the age of the youngest child instead of first child
g parentcat=.
/* non-parent */ replace parentcat=1 if children==0
/* new born (0-2 years old) */ replace parentcat=2 if kidsmall<=2
/* kindergarten (3-5 years old) */ replace parentcat=3 if kidsmall>=3 & kidsmall<=5
/* primary (6-12 years old) */ replace parentcat=4 if kidsmall>=6 & kidsmall<=12
/* teenager (13-16 years old) */ replace parentcat=5 if kidsmall>=13 & kidsmall<=16
/* 17+*/ replace parentcat=6 if kidsmall>=17 & kidsmall<=20
lab variable parentcat "Parents by age of first child"
lab def parentcat 1"Non-parent" 2"New born" 3"Kindergarten" 4"Primary" 5"Early teen" 6"Late teen", replace
lab values parentcat parentcat


***number of children
gen numchildren1=0
replace numchildren1=1 if fa456!=.
replace numchildren1=2 if fa457!=.
replace numchildren1=3 if fa458!=.
replace numchildren1=4 if fa459!=.
replace numchildren1=5 if fa460!=.
replace numchildren1=6 if fa461!=.
replace numchildren1=7 if fa462!=.
replace numchildren1=8 if fa463!=.
replace numchildren1=9 if fa464!=.
replace numchildren1=10 if fa465!=.
replace numchildren1=11 if fa466!=.
replace numchildren1=12 if fa467!=.
replace numchildren1=13 if fa468!=.
replace numchildren1=14 if fa469!=.
replace numchildren1=15 if fa470!=.
gen numchildren2=0
replace numchildren2=1 if fa037!=.
replace numchildren2=2 if fa038!=.
replace numchildren2=3 if fa039!=.
replace numchildren2=4 if fa040!=.
replace numchildren2=5 if fa041!=.
replace numchildren2=6 if fa042!=.
replace numchildren2=7 if fa043!=.
replace numchildren2=8 if fa044!=.
replace numchildren2=9 if fa045!=.
replace numchildren2=10 if fa046!=.
replace numchildren2=11 if fa047!=.
replace numchildren2=12 if fa048!=.
replace numchildren2=13 if fa049!=.
replace numchildren2=14 if fa050!=.

egen numchildren=rowtotal(numchildren1 numchildren2), m
tab numchildren numchildren2
tab numchildren numchildren1

replace numchildren=0 if children==0

gen singlechild=.
replace singlechild=0 if children==0
replace singlechild=1 if children==1 & numchildren==1

*****************************************************

********************************************************************************

** Additional variables for robustness checks

** Dependent variables: other types of media consumption

ta po002 
ta po003 
ta po004 
ta po005 
ta po006 
ta po008 
ta po009 
ta po010 
ta po011 
ta po012

**different media consumption
recode po002 (-9=.), gen(mediaTV)
recode po003 (-9=.), gen(mediaWeb)
recode po004 (-9=.), gen(mediafreenews)
recode po005 (-9=.), gen(mediapaidnews)

**International news
tab po011


**childcare
egen childcare=anycount(fa238 fa239 fa240 fa241 fa242 fa243 fa244 fa245 fa246), val(1)
tab childcare
tab childcare fa247, m
recode childcare (1/6=1)
replace childcare=. if fa247==.
tab childcare children, m

gen childcarewithnonparents=.
replace childcarewithnonparents=1 if childrenalt==0
replace childcarewithnonparents=2 if childrenalt==1 & childcare==0
replace childcarewithnonparents=3 if childrenalt==1 & childcare==1
label def care 1 "non parents" 2 "without care" 3 "with care"
label val childcarewithnonparents care

**number of children categorical
recode numchildren (0=0) (1=1) (2=2) (3/4=3) (5/6=4) (7/15=5), gen(numchildrenCAT)
tab numchildrenCAT
label def numchild 0 "0" 1 "1" 2 "2" 3 "3/4" 4 "5/6" 5 "7/15"
label val numchildrenCAT numchild

***corrected by number of children
 *variable combining number of children and parent category (children ages)
 gen parentcatCORR=.
 replace parentcatCORR=0 if numchildren==0 & parentcat==1
 replace parentcatCORR=1 if numchildren==1 & parentcat==2
 replace parentcatCORR=2 if numchildren==1 & parentcat>2
 replace parentcatCORR=3 if numchildren>1 & parentcat==2
 replace parentcatCORR=4 if numchildren>1 & parentcat>2
 replace parentcatCORR=. if parentcat==.
 label def parentcatCORR 0 "Non-parent" 1 "1 new born" 2 "1 older than 2" 3 "more than 1, at least 1 new born" 4 "more than 1 older than 2"
 label val parentcatCORR parentcatCORR
 tab parentcatCORR parentcat, m
 tab parentcatCORR numchildren, m
 
 ** Children & childcare (table a16)

g kidcare=.
/* Non-parents */ replace kidcare=1 if parentcat==1
/* Newborn with childcare */ replace kidcare=2 if parentcat==2 & childcare==1
/* Newborn without childcare */ replace kidcare=3 if parentcat==2 & childcare==0
/* Kindergarten with childcare */replace kidcare=4 if parentcat==3 & childcare==1
/* Kindergarten without childcare */ replace kidcare=5 if parentcat==3 & childcare==0
lab var kidcare "Parental status & childcare"
lab def kidcare 1"Non-parents" 2"Newborn child & childcare" 3"Newborn child & no childcare" 4"Kindergarten & childcare" 5"Kindergarten & no childcare"
lab val kidcare kidcare 
 
 
  ** Living with your current partner

ta fa025
recode fa025 (1=1 "yes") (2=0 "no") (else=.), into(partner)

label variable partner "Living with partner"


**has used parental leave
  recode w440 (2=0), gen(parentleave)
  
**currently working less hours to care for children
 recode w446 (2=0), gen(workcare)
 
 
****** Political participatition (Table A17)
  
recode po067 (-9=.), g(hearing)
recode po068 (-9=.), g(contact)
recode po070 (-9=.), g(demonstration)

recode w005 (1 2 3 4=1 "Lower than basic") (5/19=2 "Secondary and vocational") (20/26=3 "Tertiary") (else=.),g(education)